<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .main {
        width: 600px;
        height: 600px;
      }
    </style>
  </head>
  <body>
    <div class="main"></div>
    <script src="../assets/lib/echarts/echarts.min.js"></script>
    <script>
      const myChart = echarts.init(document.querySelector(".main"));
      const option = {
        color: ["red", "blue"], //线条颜色
        dataZoom: [
          {
            // 滑块开始的位置
            start: 0,
            // 滑块结束位置
            end: 30,
          },
        ], //底部滑块
        title: {
          text: "薪资Salary",
        },
        tooltip: {
          trigger: "axis",
        },
        // 薪资标题
        legend: {},
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {},
        series: [
          {
            // 设置图例 实心圆
            symbol: "circle",
            name: "期待薪资",
            type: "line",
            // 平滑
            smooth: true,
            data: [10, 11, 13, 11, 12, 12, 9],
          },
          {
            // 设置图例 实心圆
            symbol: "circle",
            name: "实际薪资",
            type: "line",
            // 平滑
            smooth: true,
            data: [1, -2, 2, 5, 3, 2, 0],

            markLine: {
              data: [
                [
                  {
                    symbol: "none",
                    x: "90%",
                    yAxis: "max",
                  },
                  {
                    symbol: "circle",
                    label: {
                      position: "start",
                      formatter: "Max",
                    },
                    type: "max",
                    name: "最高点",
                  },
                ],
              ],
            },
          },
        ],
      };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    </script>
  </body>
</html>
